package com.suray.wcs.service.pojo.rgv.rgv.protocol.message;

import com.suray.wcs.service.pojo.Rgv;
import com.suray.basic.wcs.utils.typedef.Bit;
import com.suray.basic.wcs.utils.typedef.Byte;
import com.suray.basic.wcs.utils.typedef.Word;
import com.suray.wcs.service.pojo.rgv.rgv.protocol.base.RgvRecMessage;

public class RgvRecLoraConfigMessage extends RgvRecMessage {
    public RgvRecLoraConfigMessage(Rgv rgv) {
        super(rgv, "Lora配置接收");

        baseDatas.add(new Word("头帧", "取值0x02FD"));
        baseDatas.add(new Byte("设备ID", "取值范围：0-255， 小车对应设备号"));
        baseDatas.add(new Byte("life", "0-255"));
        baseDatas.add(new Bit(1,"result", "0：错误，1：接收成功"));
        baseDatas.add(new Bit(7,"报文类型", "0:心跳，1：整体任务，2：指令，3：调试指令"));
        baseDatas.add(new Word("报文长度", "整条报文的长度"));
        baseDatas.add(new Word("校验位", "CRC（循环冗余校验；低位在前，高位在后），采用crc16_modbus"));
        baseDatas.add(new Word("尾帧", "0x3FC"));
    }

    public Integer getResult() {
        return getValue("result");
    }

    @Override
    public Integer getMessageLife() {
        return getValue("life");
    }

    @Override
    public Integer getMessageType() {
        return getValue("报文类型");
    }
}
